<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>注册界面</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="./register.css">
	<script src="./jquery-2.1.0.js" type="text/javascript"></script>
    <script>
    
		$(function(){
			$("#name").blur(function(){
				if(this.value.length==0){
					$("#p1").html("不能为空！");
					return false;
				}else{
					$("#p1").html("");
				}
			});
			$("#pas").blur(function(){
				if(this.value.length==0){
					$("#p4").html("不能为空！");
					return false;
				}else{
					$("#p4").html("");
				}
			});
			$("#repas").blur(function(){
				var repas=$("#repas").val();
				var pas=$("#pas").val();
				if(this.value.length==0){
					$("#p5").html("不能为空！");
					return false;
				}else if(repas!=pas){
					$("#p5").html("两次密码输入的不一致，请重新输入！");
					return false;
				}else{
					$("#p5").html("");
				}
			});
			$("#email").blur(function(){
				var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
				var email=$("#email").val();
				if(this.value.length==0){
					$("#p2").html("不能为空！");
					return false;
				}else if(!reg.test(email)){
					$("#p2").html("邮箱格式不正确，请重新输入！");
					return false;
				}else{
					$("#p2").html("");
				}
			});
			
		});


    </script>
  </head>

<body>
	
	<h1>论&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;坛</h1>
	<div class="div1">
		<h2>欢迎注册</h2>
		<form action="RegisterServlet" method="post">
			<label>帐&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</label> <input
				type="text" placeholder="请输入您的姓名" id="name" name="username""/><br>
			<p id="p1"></p>
			<label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</label> <input
				type="password" placeholder="请输入您的密码" id="pas" name="password""/><br>
			<p id="p4"></p>
			<label>确认密码：</label> <input type="password" placeholder="请再次输入您的密码"
				id="repas"/><br>
			<p id="p5"></p>
			<label>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</label> <input type="text" placeholder="请输入您的邮箱"
				id="email" name="email""/><br>
			<p id="p2"></p>
			<input type="submit" id="btn" value="注册"> <input type="reset"
				value="重置" id="btn1">
		</form>
	</div>
	<div class="bottom">
		<p>
		<p>Copyright © 2016-2017 湖北第二师范学院</p>
		</p>
	</div>
</body>
</html>
